package com.egobuy.product.config;

import com.egobuy.product.listener.ServletContextInitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.ServletContextListener;

/**
 * @author Hello
 */
@Configuration
public class WebConfig {
    @Autowired
    private ServletContextInitListener listener;

    @Bean
    public ServletListenerRegistrationBean servletListener(){
        ServletListenerRegistrationBean servletListenerRegistrationBean=new ServletListenerRegistrationBean();
        servletListenerRegistrationBean.setListener(listener);
        return servletListenerRegistrationBean;
    }
}
